package edu.tgc.custom;

import java.util.ArrayList;
import java.util.List;
import java.util.UUID;

import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;

public class EasyuiTree {
    public static void main(String[] args) {
        String a = "aaa";
        String b = "bbb";
        String c = "ccc";
        List<String> list = new ArrayList<>();
        list.add(a);
        list.add(b);
        list.add(c);
        ObjectMapper mapper = new ObjectMapper();
        mapper.configure(SerializationFeature.INDENT_OUTPUT, true);
        try {
            System.out.println(mapper.writeValueAsString(list));
        } catch (JsonProcessingException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
    }

    private Boolean checked;
    List<EasyuiTree> children;
    private String iconCls;
    private UUID id;
    private String state = "open";

    private String text;

    public EasyuiTree() {
        super();
    }

    public EasyuiTree(UUID id, String iconCls, String text, String state, List<EasyuiTree> children) {
        super();
        this.id = id;
        this.iconCls = iconCls;
        this.text = text;
        this.state = state;
        this.children = children;
    }

    public Boolean getChecked() {
        return this.checked;
    }

    public List<EasyuiTree> getChildren() {
        return this.children;
    }

    public String getIconCls() {
        return this.iconCls;
    }

    public UUID getId() {
        return this.id;
    }

    public String getState() {
        return this.state;
    }

    public String getText() {
        return this.text;
    }

    public void setChecked(Boolean checked) {
        this.checked = checked;
    }

    public void setChildren(List<EasyuiTree> children) {
        this.children = children;
    }

    public void setIconCls(String iconCls) {
        this.iconCls = iconCls;
    }

    public void setId(UUID id) {
        this.id = id;
    }

    public void setState(String state) {
        this.state = state;
    }

    public void setText(String text) {
        this.text = text;
    }

    @Override
    public String toString() {
        ObjectMapper mapper = new ObjectMapper();
        mapper.configure(SerializationFeature.INDENT_OUTPUT, true);
        String out = "{}";
        try {
            out = mapper.writeValueAsString(this);
        } catch (JsonProcessingException e) {
            e.printStackTrace();
        }
        return out;
    }

}
